package cn.edu.xmu.javaee.productdemoaop.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
import cn.edu.xmu.javaee.productdemoaop.repository.entity.Productjpa;
import cn.edu.xmu.javaee.productdemoaop.repository.entity.OnSalejpa;
import java.time.LocalDateTime;

public interface OnSaleRepository extends JpaRepository<OnSalejpa, Long>{
    List<OnSalejpa> findAllByProductId(Long productId);
    List<OnSalejpa> findAllByProductIdAndBeginTimeLessThanEqualAndEndTimeGreaterThan(Long productId, LocalDateTime beginTime, LocalDateTime endTime);
}
